Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) mysql> show tables; +--------------------+ | Tables_in_libreria | +--------------------+ | asignatura | | autor | | editorial | | liautedi | | libro | +--------------------+ 5 rows in set (1.36 sec) mysql> describe autor; +----------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+----------+------+-----+---------+-------+ | codautor | char(10) | NO | PRI | NULL | | | nombre | char(40) | NO | | NULL | | +----------+----------+------+-----+---------+-------+ 2 rows in set (1.53 sec) mysql> select * from autor; +----------+----------------------+ | codautor | nombre | +----------+----------------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez Posada | | A03 | Jhon Soars | | A04 | Riaz Khadem | | A05 | Robert Lorber | | A06 | Mario Dream | +----------+----------------------+ 6 rows in set (0.17 sec) mysql> delimiter // mysql> create procedure listar_autor() -> begin -> select * from autor; -> end -> // Query OK, 0 rows affected (0.48 sec) mysql> delimiter ; mysql> show procedure status; +----------+--------------+-----------+----------------+---------------------+-- -------------------+---------------+---------+----------------------+----------- -----------+--------------------+ | Db | Name | Type | Definer | Modified | C reated | Security_type | Comment | character_set_client | collation_ connection | Database Collation | +----------+--------------+-----------+----------------+---------------------+-- -------------------+---------------+---------+----------------------+----------- -----------+--------------------+ | libreria | listar_autor | PROCEDURE | root@localhost | 2015-11-07 11:44:00 | 2 015-11-07 11:44:00 | DEFINER | | cp850 | cp850_gene ral_ci | latin1_swedish_ci | +----------+--------------+-----------+----------------+---------------------+-- -------------------+---------------+---------+----------------------+----------- -----------+--------------------+ 1 row in set (0.05 sec) mysql> call listar_autor(); +----------+----------------------+ | codautor | nombre | +----------+----------------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez Posada | | A03 | Jhon Soars | | A04 | Riaz Khadem | | A05 | Robert Lorber | | A06 | Mario Dream | +----------+----------------------+ 6 rows in set (1.01 sec) Query OK, 0 rows affected (1.05 sec) mysql> describe libro; +-------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+----------+------+-----+---------+-------+ | id_libro | char(10) | NO | PRI | NULL | | | Descripcion | char(40) | NO | | NULL | | | nropaginas | int(4) | NO | | NULL | | | precio | int(7) | NO | | NULL | | | codigo_mat | char(10) | YES | | NULL | | +-------------+----------+------+-----+---------+-------+ 5 rows in set (0.11 sec) mysql> select * from libros; ERROR 1146 (42S02): Table 'libreria.libros' doesn't exist mysql> select * from libro; +----------+------------------------------+------------+--------+------------+ | id_libro | Descripcion | nropaginas | precio | codigo_mat | +----------+------------------------------+------------+--------+------------+ | L01 | calculo II | 120 | 55000 | M01 | | L02 | base de datos II | 150 | 65000 | M09 | | L03 | Estructura de datos | 180 | 85000 | M03 | | L04 | Ingles | 280 | 105000 | M04 | | L05 | administracion en una pagina | 70 | 7500 | M05 | | L06 | Contabilidad I | 170 | 27500 | M06 | | L07 | Redes | 370 | 32500 | M07 | | L08 | Diagramacion | 85 | 45000 | M08 | +----------+------------------------------+------------+--------+------------+ 8 rows in set (0.00 sec) mysql> delimiter // mysql> create_procedure listar_libros() -> begin -> select * from libro; -> end -> // ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n ear 'create_procedure listar_libros() begin select * from libro; end' at line 1 mysql> delimiter ; mysql> delimiter // mysql> create procedure listar_libro(); -> begin -> select * from libro; -> end -> // ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n ear '; begin select * from libro; end' at line 1 mysql> delimiter ; mysql> delimiter // mysql> create procedure listar_autor() -> begin -> select * from libro; -> end -> // ERROR 1304 (42000): PROCEDURE listar_autor already exists mysql> delimiter ; mysql> show procedure status; +----------+--------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+- ---------------------+--------------------+ | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation | +----------+--------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+- ---------------------+--------------------+ | libreria | listar_autor | PROCEDURE | root@localhost | 2015-11-07 11:44:00 | 2015-11-07 11:44:00 | DEFINER | | cp850 | cp850_general_ci | latin1_swedish_ci | +----------+--------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+- ---------------------+--------------------+ 1 row in set (0.08 sec) mysql> delimiter // mysql> create procedure listar_libros() -> begin -> select * from libro; -> end -> // Query OK, 0 rows affected (0.05 sec) mysql> delimiter ; mysql> call listar_libro(); ERROR 1305 (42000): PROCEDURE libreria.listar_libro does not exist mysql> call listar_libros(); +----------+------------------------------+------------+--------+------------+ | id_libro | Descripcion | nropaginas | precio | codigo_mat | +----------+------------------------------+------------+--------+------------+ | L01 | calculo II | 120 | 55000 | M01 | | L02 | base de datos II | 150 | 65000 | M09 | | L03 | Estructura de datos | 180 | 85000 | M03 | | L04 | Ingles | 280 | 105000 | M04 | | L05 | administracion en una pagina | 70 | 7500 | M05 | | L06 | Contabilidad I | 170 | 27500 | M06 | | L07 | Redes | 370 | 32500 | M07 | | L08 | Diagramacion | 85 | 45000 | M08 | +----------+------------------------------+------------+--------+------------+ 8 rows in set (0.11 sec) Query OK, 0 rows affected (0.16 sec) mysql> describe autor; +----------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+----------+------+-----+---------+-------+ | codautor | char(10) | NO | PRI | NULL | | | nombre | char(40) | NO | | NULL | | +----------+----------+------+-----+---------+-------+ 2 rows in set (0.11 sec) mysql> delimiter // mysql> create procedure insertar_autor(in codautor_ char(10), in nombre_char(40)) -> begin -> insert into autor(codautor,nombre) values (codautor_,nombre_); -> end -> // ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n ear '(40)) begin insert into autor(codautor,nombre) values (codautor_,nombre_); end' at line 1 mysql> delimiter ; mysql> delimiter // mysql> create procedure insertar_autor(in codautor_ char(10), in nombre_ char(40)) -> begin -> insert into autor(codautor, nombre) values (codautor_,nombre); -> end -> // Query OK, 0 rows affected (0.03 sec) mysql> call insertar_autor('A08','Jorge luis Borges'); -> delimiter ; -> call insertar_autor('A08','Jorge luis Borges'); -> call insertar_autor('A08','Jorge luis Borges')// Query OK, 1 row affected (0.44 sec) ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n ear 'delimiter ;call insertar_autor('A08','Jorge luis Borges'); call insertar_autor('' at line 1 mysql> delimiter // mysql> create procedure insertar_autor(in codautor_ char(10), in nombre_ char(40)) -> begin -> insert into autor(codautor,nombre) values (codautor_,nombre_); -> end -> // ERROR 1304 (42000): PROCEDURE insertar_autor already exists mysql> drop procedure insertar_autor; -> // Query OK, 0 rows affected (0.09 sec) mysql> drop procedure insertar_autor// ERROR 1305 (42000): PROCEDURE libreria.insertar_autor does not exist mysql> delimiter // mysql> create procedure insertar_autor(in codautor_ char(10), in nombre_ char(40)) -> begin -> insert into autor(codautor,nombre) values (codautor_,nombre_); -> end -> // Query OK, 0 rows affected (0.00 sec) mysql> call insertar_autor('A08','Jorge Luis Borges'); -> call insertar_autor('A06','Mario Dream'); -> ; -> ; -> // ERROR 1062 (23000): Duplicate entry 'A08' for key 'PRIMARY' mysql> call insertar_autor('A06','Mario Dream'); -> // ERROR 1062 (23000): Duplicate entry 'A06' for key 'PRIMARY' mysql> delimiter ; mysql> show procedure status; +----------+----------------+-----------+----------------+---------------------+---------------------+---------------+---------+---------------------- +----------------------+--------------------+ | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation | +----------+----------------+-----------+----------------+---------------------+---------------------+---------------+---------+---------------------- +----------------------+--------------------+ | libreria | insertar_autor | PROCEDURE | root@localhost | 2015-11-07 12:42:28 | 2015-11-07 12:42:28 | DEFINER | | cp850 | cp850_general_ci | latin1_swedish_ci | | libreria | listar_autor | PROCEDURE | root@localhost | 2015-11-07 11:44:00 | 2015-11-07 11:44:00 | DEFINER | | cp850 | cp850_general_ci | latin1_swedish_ci | | libreria | listar_libros | PROCEDURE | root@localhost | 2015-11-07 12:17:39 | 2015-11-07 12:17:39 | DEFINER | | cp850 | cp850_general_ci | latin1_swedish_ci | +----------+----------------+-----------+----------------+---------------------+---------------------+---------------+---------+---------------------- +----------------------+--------------------+ 3 rows in set (0.11 sec) mysql> call insertar_autor('a08','Jorge Luis Borges'); ERROR 1062 (23000): Duplicate entry 'a08' for key 'PRIMARY' mysql> call listar_autor(); +----------+----------------------+ | codautor | nombre | +----------+----------------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez Posada | | A03 | Jhon Soars | | A04 | Riaz Khadem | | A05 | Robert Lorber | | A06 | Mario Dream | | A08 | | +----------+----------------------+ 7 rows in set (0.03 sec) Query OK, 0 rows affected (0.06 sec) mysql> show create procedure insertar_autor; +----------------+------------------------+----------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------+----------------------+----------------------+--------------------+ | Procedure | sql_mode | Create Procedure | character_set_client | collation_connection | Database Collation | +----------------+------------------------+----------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------+----------------------+----------------------+--------------------+ | insertar_autor | NO_ENGINE_SUBSTITUTION | CREATE DEFINER=`root`@`localhost` PROCEDURE `insertar_autor`(in codautor_ char(10), in nombre_ char(40)) begin insert into autor(codautor,nombre) values (codautor_,nombre_); end | cp850 | cp850_general_ci | latin1_swedish_ci | +----------------+------------------------+----------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------+----------------------+----------------------+--------------------+ 1 row in set (0.02 sec) mysql> call insertar_autor('a08','Javier Luis Borges'); ERROR 1062 (23000): Duplicate entry 'a08' for key 'PRIMARY' mysql> call insertar_autor('A09','Javier Luis Borges'); Query OK, 1 row affected (0.09 sec) mysql> call listar_autor(); +----------+----------------------+ | codautor | nombre | +----------+----------------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez Posada | | A03 | Jhon Soars | | A04 | Riaz Khadem | | A05 | Robert Lorber | | A06 | Mario Dream | | A08 | | | A09 | Javier Luis Borges | +----------+----------------------+ 8 rows in set (0.00 sec) Query OK, 0 rows affected (0.03 sec) mysql> describe libro; +-------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+----------+------+-----+---------+-------+ | id_libro | char(10) | NO | PRI | NULL | | | Descripcion | char(40) | NO | | NULL | | | nropaginas | int(4) | NO | | NULL | | | precio | int(7) | NO | | NULL | | | codigo_mat | char(10) | YES | | NULL | | +-------------+----------+------+-----+---------+-------+ 5 rows in set (0.03 sec) mysql>